# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2Client do
  @moduledoc """
  Represents the OAuth 2.0 client credential configuration for retrieving additional user attributes that are not present in the initial authentication credentials from the identity provider, e.g. groups. See https://datatracker.ietf.org/doc/html/rfc6749#section-4.4 for more details on client credentials grant flow.

  ## Attributes

  *   `attributesType` (*type:* `String.t`, *default:* `nil`) - Required. Represents the IdP and type of claims that should be fetched.
  *   `clientId` (*type:* `String.t`, *default:* `nil`) - Required. The OAuth 2.0 client ID for retrieving extra attributes from the identity provider. Required to get the Access Token using client credentials grant flow.
  *   `clientSecret` (*type:* `GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderOidcClientSecret.t`, *default:* `nil`) - Required. The OAuth 2.0 client secret for retrieving extra attributes from the identity provider. Required to get the Access Token using client credentials grant flow.
  *   `issuerUri` (*type:* `String.t`, *default:* `nil`) - Required. The OIDC identity provider's issuer URI. Must be a valid URI using the `https` scheme. Required to get the OIDC discovery document.
  *   `queryParameters` (*type:* `GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2ClientQueryParameters.t`, *default:* `nil`) - Optional. Represents the parameters to control which claims are fetched from an IdP.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :attributesType => String.t() | nil,
          :clientId => String.t() | nil,
          :clientSecret =>
            GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderOidcClientSecret.t() | nil,
          :issuerUri => String.t() | nil,
          :queryParameters =>
            GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2ClientQueryParameters.t()
            | nil
        }

  field(:attributesType)
  field(:clientId)

  field(:clientSecret,
    as: GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderOidcClientSecret
  )

  field(:issuerUri)

  field(:queryParameters,
    as:
      GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2ClientQueryParameters
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2Client do
  def decode(value, options) do
    GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2Client.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.IAM.V1.Model.GoogleIamAdminV1WorkforcePoolProviderExtraAttributesOAuth2Client do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
